package 设计模式.装饰模式;

//装饰者
public class Decorator extends Drink{//继承drink

    //聚合drink
    private Drink obj;

    public Decorator(Drink obj) {//聚合
        this.obj = obj;
    }

    @Override
    public float cost() {
        //先拿到自己的价格
        return super.getPrice() + obj.cost();
    }

    @Override
    public String getDes() {
        //obj.getDes 输出被装饰者的信息
        return super.getDes() + " " + super.getPrice() + " && "+ obj.getDes();
    }
}
